import 'package:xinxuan/vo/common_vo/common_pagination_vo.dart';

class GiftListVo {
  
  List<GiftItem>? data;
  GiftMeta? meta;

  GiftListVo({this.data, this.meta});

  GiftListVo.fromJson(Map<String, dynamic> json) {
    if (json['data'] != null) {
      data = [];
      json['data'].forEach((v) {
        data!.add(new GiftItem.fromJson(v));
      });
    }
    meta = json['meta'] != null ? new GiftMeta.fromJson(json['meta']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.data != null) {
      data['data'] = this.data!.map((v) => v.toJson()).toList();
    }
    if (this.meta != null) {
      data['meta'] = this.meta!.toJson();
    }
    return data;
  }
}

class GiftItem {
  int? id;
  String? title;
  String? image;
  String? type;
  int? giftId;
  int? userId;
  int? quantity;
  int? stock;
  String? createdAt;
  String? price;

  GiftItem(
      {this.id,
      this.title,
      this.image,
      this.type,
      this.giftId,
      this.userId,
      this.quantity,
      this.stock,
      this.createdAt,
      this.price});

  GiftItem.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    title = json['title'];
    image = json['image'];
    type = json['type'];
    giftId = json['gift_id'];
    userId = json['user_id'];
    quantity = json['quantity'];
    stock = json['stock'];
    createdAt = json['created_at'];
    price = json['price'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['title'] = this.title;
    data['image'] = this.image;
    data['type'] = this.type;
    data['gift_id'] = this.giftId;
    data['user_id'] = this.userId;
    data['quantity'] = this.quantity;
    data['stock'] = this.stock;
    data['created_at'] = this.createdAt;
    data['price'] = this.price;
    return data;
  }
}

class GiftMeta {
  CommonPagination? pagination;

  GiftMeta({this.pagination});

  GiftMeta.fromJson(Map<String, dynamic> json) {
    pagination = json['pagination'] != null
        ? new CommonPagination.fromJson(json['pagination'])
        : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.pagination != null) {
      data['pagination'] = this.pagination!.toJson();
    }
    return data;
  }
}